package com.company.OfferGuide;

public class 剪绳子 {

    public static void main(String[] args) {
        System.out.println(cuttingRope(120));
    }

    public static int cuttingRope(int n) {
        if (n == 2) return 1;
        if (n == 3) return 2;
        int i3 = 0,i2 = 0;
        i3 = n /3;
        if (n - i3 * 3 == 1) {
            i3--;
        }
        i2 = (n - i3 *3) / 2;
        return (int)Math.pow(2,i2) * (int)Math.pow(3,i3);
    }

}
